package com.spzx.product.controller;

import com.spzx.common.core.domain.R;
import com.spzx.common.security.annotation.InnerAuth;
import com.spzx.product.domain.ProductSku;
import com.spzx.product.service.ProductSkuService;
import com.spzx.product.vo.ProductSkuVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.spzx.common.core.web.controller.BaseController;

/**
 * <p>
 * 商品sku 前端控制器
 * </p>
 *
 * @author atguigu
 * @since 2025-04-28
 */
@RestController
@RequestMapping("/productSku")
public class ProductSkuController extends BaseController {

    @Autowired
    private ProductSkuService productSkuService;
    @InnerAuth
    @GetMapping("getProductSku/{skuId}")
    public R<ProductSkuVo> getProductSkuVo(@PathVariable Long skuId){
        ProductSkuVo productSkuVo = new ProductSkuVo();
        ProductSku productSku = productSkuService.getById(skuId);
        BeanUtils.copyProperties(productSku,productSkuVo);
        return R.ok(productSkuVo);
    }
}
